function display(isDisplayAll) {
    // 字典隐藏选项集合
    let hideDict = [
        {
            dictDataName: "项目计划",
            dictDataId: "ae7e345ca8fd76827a3590e038efb94b",
        },
        {
            dictDataName: "会议任务",
            dictDataId: "e0f13da9d1df4bd692518af8430845fe",
        },
        {
            dictDataName: "设计预投申请",
            dictDataId: "9d65629edb0dc87283d06fbd1572c69d",
        },
        {
            dictDataName: "合理化建议",
            dictDataId: "3a275c0eeea14665afce10787a8c42df",
        },
        {
            dictDataName: "研发评审遗留问题",
            dictDataId: "01fc5f55816fd1eafa2f7da5277e9b8d",
        },
        {
            dictDataName: "TN设计变更",
            dictDataId: "cf10c8b9abc315f5849900ddb5d2489c",
        },
        {
            dictDataName: "售后服务派工",
            dictDataId: "e2aefbdcd46685259dfca36ede6a2c62",
        },
        {
            dictDataName: "研发计划",
            dictDataId: "a5e1a504941c1732ee44847e2299fc1c",
        },
        {
            dictDataName: "研发关联问题",
            dictDataId: "c0ae1698d0ff0544d555151c87a08db2",
        },
    ]
    //业务:动态隐藏字典项,查找字典值中的计划任务,并将其从数组中移除
    hideDict.forEach(item => {
        for (let i = 0; i < $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].length; i++) {
            //隐藏 任务选项，1.当任务类型为空的时候全部隐藏，2.当任务类型不为空时，判断任务类型是否等于字典项的值，如果不等于则隐藏
            let dictDataNameStorage = $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataName"]
            let dictDataIdStorage = $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"][i]["dictDataId"]
            if (isDisplayAll && dictDataNameStorage === item.dictDataName) {
                // console.log("隐藏", item)
                $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i, 1)
            } else if (dictDataNameStorage === item.dictDataName && dictDataIdStorage !== $this.model.select_1711505903223_YWk8w) {
                // console.log("隐藏", item)
                $this.storage["caaaa4d81408aa1c03564db7f70660ac_dict"].splice(i, 1)
            }
        }
    })
}


async function main() {
    //任务类型下拉选中计划任务
    if ($this.model["select_1711505903223_YWk8w"] == "ae7e345ca8fd76827a3590e038efb94b") {
        for (let i = 0; i < $this.form.fields.length; i++) {
            if ($this.form.fields[i]["name"] === "select_1711505903223_YWk8w") {
                //任务类型只读
                $this.form.fields[i]['readonly'] = true
            }
        }
    }
    // 是否隐藏hideDict配置的所有字典项
    let isDisplayAll = true

    //新增页面
    if ($this.pageType == 'add') {
        if ($this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1]) {
            let id = $this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1].id
            let riskData = $this.$store.state.user.tabs[$this.$store.state.user.tabs.length - 1].riskData
            if (id != undefined) {
                $this.taskId = id
                let url = $this.$util.getAPI_URL();
                let formData = new FormData();
                formData.append("id", id);
                url = url.replace("api", "task/taskbyId");
                //最后一个标签页的数据有id则调用API获取任务详情，将返回的数据赋值到$this.model中
                await $this.$http.post(url, formData).then((res) => {
                    if (res.data.code === 280) {
                        console.log("data = ",res.data.data);
                        //数据赋值逻辑
                        $this.model.input_1711507868739_utRet = res.data.data[0]["bill_id"]
                        $this.model.input_1711507870054_pCWPe = res.data.data[0]["commonNumber_1711532225675_bFKuy"]
                        $this.model.input_1711507872142_QBS6q = res.data.data[0]["input_1711439260720_6QPqX"]
                        $this.model.input_1718345101976_ZNGth = res.data.data[0]["input_1718345101976_ZNGth"]
                        $this.model.input_1718345101976_PBcTl = res.data.data[0]["input_1718345101976_PBcTl"]
                        $this.model.selectStr_1718345029613_IWjr8 = res.data.data[0]["selectStr_1718345029613_IWjr8"]
                        $this.model.selectStr_1718345029613_IWjr8_ID = res.data.data[0]["selectStr_1718345029613_IWjr8_ID"]
                        $this.model.textarea_1755766219698_SuIuk= res.data.data[0]["textarea_1755766219698_SuIuk"]

                        if (!Array.isArray(res.data.data[0]["rangePicker_1711439307444_Ftzhm"])) {
                            let dates = JSON.parse(res.data.data[0]["rangePicker_1711439307444_Ftzhm"])
                            $this.model.rangePicker_1754897348453_DOtbH = [$this.moment(dates[0], "YYYY-MM-DD HH:mm:ss"), $this.moment(dates[1], "YYYY-MM-DD HH:mm:ss")]
                        } else {
                            $this.model.rangePicker_1754897348453_DOtbH = [$this.moment(res.data.data[0]["rangePicker_1711439307444_Ftzhm"][0], "YYYY-MM-DD HH:mm:ss"), $this.moment(res.data.data[0]["rangePicker_1711439307444_Ftzhm"][1], "YYYY-MM-DD HH:mm:ss")]
                        }

                        $this.model.select_1711505903223_YWk8w = res.data.data[0]["select_1711505903223_YWk8w"]
                        if (res.data.data[0]["input_1711505190040_mjQ7O"]) {
                            $this.model.input_1711505190040_mjQ7O = res.data.data[0]["input_1711505190040_mjQ7O"]
                            $this.model.input_1711505191772_z744J = res.data.data[0]["input_1711505191772_z744J"]

                            for (let i = 0; i < $this.form.fields.length; i++) {
                                if ($this.form.fields[i]["name"] === "select_1711505903223_YWk8w") {
                                    $this.form.fields[i]['readonly'] = true
                                }
                            }

                        }
                        $this.$nextTick(() => {
                            document.getElementById("selectStr_1718345029613_IWjr8_NO").value = res.data.data[0]["input_1718345101976_PBcTl"]
                        });
                    }

                    // 隐藏字典项
                    isDisplayAll = false
                    display(isDisplayAll)

                })
                //
                for (let i = 0; i < $this.form.fields.length; i++) {
                    //字段显示控制
                    if ($this.form.fields[i].name == 'separator_1711507808321_wPJ5T' || $this.form.fields[i].name == 'input_1711507872142_QBS6q' || $this.form.fields[i].name == 'rangePicker_1754897348453_DOtbH') {
                        //控制字段的显示状态
                        $this.form.fields[i].isShow = true
                    }
                }
            }
            //页面数据赋值
            if (riskData != undefined) {
                $this.model.select_1711505903223_YWk8w = '88b3d81abfc18c0a0dffe358db029aa8'
                $this.model.selectStr_1718345029613_IWjr8 = riskData["项目表单编号"]
                $this.model.selectStr_1718345029613_IWjr8_ID = riskData["项目ID"]
                $this.model.input_1718345101976_ZNGth = riskData["项目编号"]
                $this.model.input_1718345101976_PBcTl = riskData["项目名称"]
                $this.model.input_1720753145812_YHQZf = riskData["FXID"]
                $this.model.input_1711439260720_6QPqX = riskData["项目名称"]
                $this.$nextTick(() => {
                    document.getElementById("selectStr_1718345029613_IWjr8_NO").value = riskData["项目名称"]
                });
                $this.model.systemSelect_1711439392784_Njyxy = riskData["ZXR"]
                document.getElementById("systemSelect_1711439392784_Njyxy_ID").value = riskData["ZXRID"]
            }
            let url = $this.$route.href
            let questionMarkIndex = url.indexOf("?");
            if (questionMarkIndex !== -1) {
                //根据URL的查询参数Type,设置select_1711505903223_YWk8w 的值
                let type = url.substring(questionMarkIndex + 1);
                if (type == 1) {
                    //项目任务
                    $this.model.select_1711505903223_YWk8w = "88b3d81abfc18c0a0dffe358db029aa8"
                } else if (type == 0) {
                    //合理化提案
                    $this.model.select_1711505903223_YWk8w = "3a275c0eeea14665afce10787a8c42df"
                }
            }

        }

    }

    // console.log("isDisplayAll", isDisplayAll)
    display(isDisplayAll)
}

main()

